package entity;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.sun.org.apache.bcel.internal.generic.RETURN;

public class Order {

	private int orderId; //订单编号
	private int userId; //订单所属用户的编号
	private UserAddress userAddress; //当前订单的收货地址
	private String orderStatus; //订单状态
	private Date startTime; //订单的下单时间
	private Date endTime;	//订单的完成时间
	private String startTimeFmt;
	private String endTimeFmt;
	private List<OrderItem> orderItem;
	
	public String getStartTimeFmt() {
		return startTimeFmt;
	}
	public void setStartTimeFmt(String startTimeFmt) {
		this.startTimeFmt = startTimeFmt;
	}
	public String getEndTimeFmt() {
		return endTimeFmt;
	}
	public void setEndTimeFmt(String endTimeFmt) {
		this.endTimeFmt = endTimeFmt;
	}
	public int getOrderId() {
		return orderId;
	}
	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public UserAddress getUserAddress() {
		return userAddress;
	}
	public void setUserAddress(UserAddress userAddress) {
		this.userAddress = userAddress;
	}
	public String getOrderStatus() {
		return orderStatus;
	}
	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public List<OrderItem> getOrderItem() {
		return orderItem;
	}
	public void setOrderItem(List<OrderItem> orderItem) {
		this.orderItem = orderItem;
	}
	public Order(int orderId, int userId, UserAddress userAddress, String orderStatus, Date startTime, Date endTime,
			List<OrderItem> orderItem) {
		super();
		this.orderId = orderId;
		this.userId = userId;
		this.userAddress = userAddress;
		this.orderStatus = orderStatus;
		this.startTime = startTime;
		this.endTime = endTime;
		this.orderItem = orderItem;
		this.startTimeFmt = startTimeFormat();
		this.endTimeFmt = endTimeFormat();
	}
	public Order() {
		super();
	}
	public Order(int orderId, int userId, UserAddress userAddress, String orderStatus, Date startTime, Date endTime) {
		super();
		this.orderId = orderId;
		this.userId = userId;
		this.userAddress = userAddress;
		this.orderStatus = orderStatus;
		this.startTime = startTime;
		this.endTime = endTime;
	}
	public String startTimeFormat() {
		SimpleDateFormat sdf =	new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		return sdf.format(startTime);
	}
	
	public String endTimeFormat() {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		return sdf.format(endTime);
	}
	public Order(int userId, UserAddress userAddress, Date startTime) {
		super();
		this.userId = userId;
		this.userAddress = userAddress;
		this.startTime = startTime;
	}
	
}
